#ifndef MAINWINDOW_H
#define MAINWINDOW_H

#include <QMainWindow>
#include <QInputDialog>
#include <qcustomplot.h>
#include <QSettings>

namespace Ui {
class MainWindow;
}

class MainWindow : public QMainWindow
{
    Q_OBJECT

public:
    explicit MainWindow(QWidget *parent = 0);
    ~MainWindow();
    void SystemInit();
    void append_data0(double num);
    void append_data1(double num);
    void keyPressEvent(QKeyEvent *event);
    void graphClicked(QCPAbstractPlottable *plottable, int dataIndex);
    double Value_data_0;
    double Value_data_1;

private slots:
    // This function is responsible for ploting
    // and updating the graphs , with each timer tick
    void updatePlot();
    void legendDoubleClick(QCPLegend *legend, QCPAbstractLegendItem *item);
    //void test(QCPLegend *legend, QCPAbstractLegendItem *item);

private:
    Ui::MainWindow *ui;
    // Our custom plot widget
    QCustomPlot *m_CustomPlot;
    QTimer *timer;
    // This object will hold the current value as a text
    // that will appear at the extreme right of the plot,
    QCPItemText *m_ValueIndex1;
    QCPItemText *m_ValueIndex2;

    // The time between each update, this
    // will be  used by the timer to call "updatePlot" slot
    // Data buffers
    QVector<qreal> tmpYYData0;
    QVector<qreal> tmpYYData1;
    QVector<qreal> tmpXXData0;
    double timeInterval;
    double Value_P;
    double Value_I;
    double Value_D;
    bool ifPause;
    QString VauleName1;//红色
    QString VauleName2;//绿色
};

#endif // MAINWINDOW_H
